Optimal. Leaf size=193 \[ \frac {(a+b \tan (c+d x))^{1+n}}{b d (1+n)}-\frac {b \, _2F_1\left (1,1+n;2+n;\frac {a+b \tan (c+d x)}{a-\sqrt {-b^2}}\right ) (a+b \tan (c+d x))^{1+n}}{2 \sqrt {-b^2} \left (a-\sqrt {-b^2}\right ) d (1+n)}+\frac {b \, _2F_1\left (1,1+n;2+n;\frac {a+b \tan (c+d x)}{a+\sqrt {-b^2}}\right ) (a+b \tan (c+d x))^{1+n}}{2 \sqrt {-b^2} \left (a+\sqrt {-b^2}\right ) d (1+n)} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.14, antiderivative size = 193, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 4, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.190, Rules used = {3624, 3566,
726, 70} \begin {gather*} -\frac {b (a+b \tan (c+d x))^{n+1} \, _2F_1\left (1,n+1;n+2;\frac {a+b \tan (c+d x)}{a-\sqrt {-b^2}}\right )}{2 \sqrt {-b^2} d (n+1) \left (a-\sqrt {-b^2}\right )}+\frac {b (a+b \tan (c+d x))^{n+1} \, _2F_1\left (1,n+1;n+2;\frac {a+b \tan (c+d x)}{a+\sqrt {-b^2}}\right )}{2 \sqrt {-b^2} d (n+1) \left (a+\sqrt {-b^2}\right )}+\frac {(a+b \tan (c+d x))^{n+1}}{b d (n+1)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 70
Rule 726
Rule 3566
Rule 3624
Rubi steps
\begin {align*} \int \tan ^2(c+d x) (a+b \tan (c+d x))^n \, dx &=\frac {(a+b \tan (c+d x))^{1+n}}{b d (1+n)}-\int (a+b \tan (c+d x))^n \, dx\\ &=\frac {(a+b \tan (c+d x))^{1+n}}{b d (1+n)}-\frac {b \text {Subst}\left (\int \frac {(a+x)^n}{b^2+x^2} \, dx,x,b \tan (c+d x)\right )}{d}\\ &=\frac {(a+b \tan (c+d x))^{1+n}}{b d (1+n)}-\frac {b \text {Subst}\left (\int \left (\frac {\sqrt {-b^2} (a+x)^n}{2 b^2 \left (\sqrt {-b^2}-x\right )}+\frac {\sqrt {-b^2} (a+x)^n}{2 b^2 \left (\sqrt {-b^2}+x\right )}\right ) \, dx,x,b \tan (c+d x)\right )}{d}\\ &=\frac {(a+b \tan (c+d x))^{1+n}}{b d (1+n)}+\frac {b \text {Subst}\left (\int \frac {(a+x)^n}{\sqrt {-b^2}-x} \, dx,x,b \tan (c+d x)\right )}{2 \sqrt {-b^2} d}+\frac {b \text {Subst}\left (\int \frac {(a+x)^n}{\sqrt {-b^2}+x} \, dx,x,b \tan (c+d x)\right )}{2 \sqrt {-b^2} d}\\ &=\frac {(a+b \tan (c+d x))^{1+n}}{b d (1+n)}-\frac {b \, _2F_1\left (1,1+n;2+n;\frac {a+b \tan (c+d x)}{a-\sqrt {-b^2}}\right ) (a+b \tan (c+d x))^{1+n}}{2 \sqrt {-b^2} \left (a-\sqrt {-b^2}\right ) d (1+n)}+\frac {b \, _2F_1\left (1,1+n;2+n;\frac {a+b \tan (c+d x)}{a+\sqrt {-b^2}}\right ) (a+b \tan (c+d x))^{1+n}}{2 \sqrt {-b^2} \left (a+\sqrt {-b^2}\right ) d (1+n)}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 0.23, size = 138, normalized size = 0.72 \begin {gather*} \frac {\left (i (a+i b) b \, _2F_1\left (1,1+n;2+n;\frac {a+b \tan (c+d x)}{a-i b}\right )+(a-i b) \left (2 a+2 i b-i b \, _2F_1\left (1,1+n;2+n;\frac {a+b \tan (c+d x)}{a+i b}\right )\right )\right ) (a+b \tan (c+d x))^{1+n}}{2 b (-i a+b) (i a+b) d (1+n)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [F]
time = 0.31, size = 0, normalized size = 0.00 \[\int \left (\tan ^{2}\left (d x +c \right )\right ) \left (a +b \tan \left (d x +c \right )\right )^{n}\, dx\]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \tan {\left (c + d x \right )}\right )^{n} \tan ^{2}{\left (c + d x \right )}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int {\mathrm {tan}\left (c+d\,x\right )}^2\,{\left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )}^n \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________